﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AgencyEntityLib.BaseEntity;
using FormControllers;

public partial class AgencyEditor : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
              
        if (!IsPostBack) DataBind();
    }

    private string AgencyID
    {
        get { return Request.QueryString["ID"]; }
    }

    private void ReadForm()
    {
        Agency.Name = txtName.Text;
        Agency.Department.Name = txtDepartment.Text ;

    }
    
    protected void btnSave_Click(object sender, EventArgs e)
    {
        ReadForm();
        SaveAgency();
    }

    protected Agency Agency { get { wsAgency ws = new wsAgency(); return ws.GetAgency(AgencyID); } } 

    public void SaveAgency()
    {
        wsAgency ws = new wsAgency();
        ws.SaveAgency(Agency); 
    }

    protected string GetSrc()
    {
        return "EmplList.aspx?DepartmentID=" + Agency.Department.ID+"&AgencyID="+Agency .ID ;  
    }
        
}
